﻿#ifndef CVideoWorkMange_H
#define CVideoWorkMange_H
/********************************************************************************
** @ Date:2025/08/21
** @ Author: HanJiaXin
** @ Description:
** @ Version:1.0.0
** @ ClassName:
** @ Fun:
********************************************************************************/
#include <QThread>
#include <QMutex>
#include "CCamerCtrMange.h"
#include "CDevDataCam.h"

class CVideoWorkMange  : public QThread
{
	Q_OBJECT

public:
	CVideoWorkMange(CCamerCtrMange* pCamerCtrMange,CDevDataCam* pDevData);
	~CVideoWorkMange();

	void threadStart();
	void threadStop();

private:
	void queryAlarm();//查询数据库数据
	void judgmentState();//判断报警状态

protected:
	void run() override;

private:
	bool m_bShouldStop;
	bool m_bFrist;                           //是否是首次开启线程，防止重启启动设备的时候频繁创建线程
	bool m_bQueryFrist;						 //是否首次查询数据库
	std::atomic<bool>      m_bhread;         //线程状态
	QMutex   *m_pMutex;		                 //线程锁
	CCamerCtrMange* m_pCamerCtrMange;        //摄像头控制类
	CDevDataCam *m_pDevData;		
	QDateTime m_dLastTime;					//上次刷新数据库时间
	int m_nLoginCount;
};

#endif